package org.artifact.core.plugin.netty.server;

import io.netty.channel.ChannelPipeline;
import org.artifact.core.plugin.netty.codec.ByteArrayEncoder;
import org.artifact.core.plugin.netty.codec.NetworkDecoder;
import org.artifact.core.plugin.netty.codec.NetworkEncoder;
import org.artifact.core.plugin.netty.handler.SocketHandler;

/**
 * @author : SandKing
 * @CreateDate : 2020/3/25 15:42
 * @Description ：Please describe this document
 */
public class NettySocketServer extends NettyTcpServer{

	@Override
	public void buildChannelPipeline(ChannelPipeline pipeline) {
		super.buildChannelPipeline(pipeline);
		pipeline.addLast(new NetworkDecoder());
		// 此编码器主要处理请求响应,避免产生没必要的bytebuf
		pipeline.addLast(new NetworkEncoder());
		// 此编码器主要是用作处理广播,packet只进行一次序列化
		pipeline.addLast(new ByteArrayEncoder());
		pipeline.addLast(new SocketHandler());
	}
}
